package com.cn.springcloudwechat.controller.courseall;

import java.util.List;

import com.cn.springcloudwechat.common.ajax.AjaxRes;
import com.cn.springcloudwechat.common.mybatis.Page;
import com.cn.springcloudwechat.common.utils.base.Const;
import com.cn.springcloudwechat.controller.base.BaseWeChatController;
import com.cn.springcloudwechat.model.YmCoursePackage;
import com.cn.springcloudwechat.service.courseall.CoursePackageService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


@Controller
@RequestMapping("/web/course/")
@ResponseBody
public class CoursePackagePhoneController extends BaseWeChatController{
	
	
	@Autowired
	CoursePackageService coursePackageService;
	
	/**
	 * 课程包的查询
     *
	 * @return List<YmCoursePackage>
	 */
	@RequestMapping("queryCoursePackage")
    public AjaxRes queryCoursePackage(AjaxRes ajaxRes,YmCoursePackage ymcoursePackage,Page<Object> page){
        try { 
        	Page<Object> ymCoursePackages = this.coursePackageService.queryCoursePackageSer(ymcoursePackage,page);
            ajaxRes.setSucceed(ymCoursePackages,Const.DATA_SUCCEED);
        }catch (Exception e){
            ajaxRes.setFailMsg(e.getMessage());
        }
        return ajaxRes;
    }
	
	/**
	 * 课程包的查询(明细*课程包下面的课程明细)
     *
	 * @return List<YmCoursePackage>
	 */
	@RequestMapping("queryCoursePackageDetail")
    public AjaxRes queryCoursePackageDetail(AjaxRes ajaxRes,Long coursePackageId){
        try {
        	List<YmCoursePackage> ymCoursePackages = this.coursePackageService.queryCoursePackageDetailSer(coursePackageId);
            ajaxRes.setSucceed(ymCoursePackages,Const.DATA_SUCCEED);
        }catch (Exception e){
            ajaxRes.setFailMsg(e.getMessage());
        }
        return ajaxRes;
    }
	
}
